# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=pict-rs
pkgver=0.5.13
pkgrel=0
pkgdesc="Simple image hosting service written in Rust"
url="https://git.asonix.dog/asonix/pict-rs"
# riscv64: tests fail
arch="all !riscv64"
license="AGPL-3.0-or-later"
depends="exiftool ffmpeg imagemagick"
makedepends="cargo cargo-auditable"
install="$pkgname.pre-install"
pkgusers="pict-rs"
pkggroups="pict-rs"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://git.asonix.dog/asonix/pict-rs/archive/v$pkgver.tar.gz
	config-file.patch
	pict-rs.initd
	"
builddir="$srcdir/pict-rs"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/pict-rs -t "$pkgdir"/usr/bin

	install -Dm640 -g pict-rs pict-rs.toml -t "$pkgdir"/etc/pict-rs
	install -Dm755 "$srcdir"/pict-rs.initd "$pkgdir"/etc/init.d/pict-rs
}

sha512sums="
5ca1092b9c1a7f086b8884f3fd05fe11d431c509f72150fd115c21c04d3c8da71299067f1eae872f0bffaa26d7632270f583a5f1de0106b2d0a1ffefc4b1aa79  pict-rs-0.5.13.tar.gz
6abcd4907bfbf8857031af947cec088841e2a249a31a530678870c0da77667f05fdaa8c301bc12bf05b91a9054aea32f25cdb41be6d52f8140dc4340743d1d4c  config-file.patch
6a9d40fc5c57d35a6601118eff551b4353f0e544045b953cc2728135bdea1e1f8945ffac889d805b988af8403e0114338cde31d8d977491a63270ce97b8cae73  pict-rs.initd
"
